﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Field_Default : BasePage
{
    private int modelId;
    protected void Page_Load(object sender, EventArgs e)
    {
        UserPower.CheckAction((int)FreeHouse.Power.Actions.TField.List);
        if (!IsPostBack)
        {
            BindData();
        }
    }
    protected void view_Click(object sender, EventArgs e)
    {
        modelId = int.Parse(ModelId.SelectedValue);
        string where = "ModelId="+modelId.ToString();
        if (modelId == 0) where = "";
        gv.DataSource = new FreeHouse.BLL.TField().GetList(0, where, "ModelId asc,FieldId asc");
        gv.DataBind();
    }

    protected void BindData()
    {

        ModelId.DataSource = new FreeHouse.BLL.TModel().GetList(100000, "", "ModelId asc");
        ModelId.DataTextField = "ModelName";
        ModelId.DataValueField = "ModelId";
        ModelId.DataBind();
        ModelId.Items.Insert(0, new ListItem("请选择...", "0"));
    }
}
